home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / message / messag / formmove.fr_ / formmove.fr
Text File  |  1995-01-14  |  3KB  |  90 lines

  1. VERSION 2.00
  2. Begin Form FormMove 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   2760
  6.    ClientLeft      =   1080
  7.    ClientTop       =   1485
  8.    ClientWidth     =   5010
  9.    ControlBox      =   0   'False
  10.    Height          =   3165
  11.    Left            =   1020
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   2760
  16.    ScaleWidth      =   5010
  17.    Top             =   1140
  18.    Width           =   5130
  19.    Begin Message Message1 
  20.       Left            =   4740
  21.       Top             =   2400
  22.    End
  23.    Begin Label Label2 
  24.       Alignment       =   2  'Center
  25.       BackStyle       =   0  'Transparent
  26.       Caption         =   "Label2"
  27.       ForeColor       =   &H00000080&
  28.       Height          =   735
  29.       Left            =   300
  30.       TabIndex        =   1
  31.       Top             =   1800
  32.       Width           =   4395
  33.    End
  34.    Begin Label Label1 
  35.       Alignment       =   2  'Center
  36.       BackStyle       =   0  'Transparent
  37.       Caption         =   "Label1"
  38.       ForeColor       =   &H00800000&
  39.       Height          =   1455
  40.       Left            =   300
  41.       TabIndex        =   0
  42.       Top             =   180
  43.       Width           =   4395
  44.    End
  45. End
  46.  
  47. Sub Form_Load ()
  48.     FormCenterScreen Me
  49.  
  50.     Msg$ = nl + "This is not an MDI form, but it could be." + nl
  51.     Msg$ = Msg$ + "And, it does NOT have a caption." + nl
  52.     Msg$ = Msg$ + "But, you can move it by holding down" + nl
  53.     Msg$ = Msg$ + "the left mouse button and dragging" + nl
  54.     Msg$ = Msg$ + "the form around on the screen."
  55.     Label1.Caption = Msg$
  56.  
  57.     Msg$ = nl + "Dbl-Click the right mouse button" + nl
  58.     Msg$ = Msg$ + "on the form to close it..."
  59.     Label2.Caption = Msg$
  60.  
  61.     Message1.hWindow = Me.hWnd
  62.     Message1.Status(WM_NCHITTEST) = True
  63.     Message1.Status(WM_NCrButtonDblClk) = True
  64.     
  65.     Screen.MousePointer = 0
  66. End Sub
  67.  
  68. Sub Form_Paint ()
  69.     DoForm3D Me, "raised", 2, 0
  70.     DoForm3D Me, "sunken", 2, 2
  71.  
  72.     DoControl3D Label1, "sunken", 1
  73.     DoControl3D Label2, "sunken", 1
  74. End Sub
  75.  
  76. Sub Message1_Receive (Msg As Integer, wParam As Integer, lParam As Long, UseRetVal As Integer, RetVal As Long)
  77.       
  78.     If Msg = WM_NCHITTEST Then
  79.         RetVal = HTCAPTION
  80.         UseRetVal = 1
  81.         Exit Sub
  82.         End If
  83.         
  84.     If Msg = WM_NCrButtonDblClk Then
  85.         'don't use SendMessage in a Receive event!!!
  86.         ret% = PostMessage(Me.hWnd, WM_CLOSE, 0, 0&)
  87.         End If
  88. End Sub
  89.  
  90.